Skip to content

Conversation

Copy link

Copilot AI commented Jan 13, 2026

Summary

The original test testEventDispatcherCanDispatchInstallationCompletedEvent created a mock dispatcher and manually called dispatchTyped(), which didn't verify that Setup::install() correctly extracts parameters from the options array and dispatches the event.

Changes

  • Replaced test with testInstallationCompletedEventParametersFromInstallOptions() - verifies event construction using parameters extracted from install options matching Setup::install() logic (lines 329, 502-503, 504-506)
  • Added testInstallationCompletedEventWithDisabledAdminUser() - tests admindisable=true scenario resulting in null admin username
  • Extracted extractInstallationEventParameters() helper to mirror parameter extraction logic and reduce duplication

Note: Full integration testing of Setup::install() requires database setup, user creation, app installation, and Server dependency injection - impractical for unit tests. The InstallationCompletedEvent class itself is comprehensively tested in InstallationCompletedEventTest.php.

TODO

N/A

Checklist


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits January 13, 2026 12:25
…extraction

Replace testEventDispatcherCanDispatchInstallationCompletedEvent with tests that verify
the event is constructed with correct parameters extracted from install options.

The original test created a mock dispatcher and manually dispatched the event, which didn't
test the real integration with Setup::install(). The new tests verify that parameters are
extracted correctly from the options array in the same way Setup::install() does (lines 502-506).

Testing the full install() method requires a complete installation environment (database,
file system, Server::get() dependencies) which is impractical in a unit test. The event
class itself is comprehensively tested in InstallationCompletedEventTest.php.

Co-authored-by: printminion-co <145785698+printminion-co@users.noreply.github.com>
Address code review feedback:
- Extract duplicated parameter extraction logic into extractInstallationEventParameters() helper
- Fix line number references in comments to be more accurate (line 329 for dataDir, lines 502-503 for admin params, lines 505-506 for event creation)
- Improve code maintainability by reducing duplication

Co-authored-by: printminion-co <145785698+printminion-co@users.noreply.github.com>
Update comments to correctly reference Setup.php lines:
- Line 329: dataDir extraction
- Lines 502-503: admin parameter extraction
- Lines 504-506: event dispatch

Co-authored-by: printminion-co <145785698+printminion-co@users.noreply.github.com>
Document that extractInstallationEventParameters() assumes the 'directory' key is present,
referencing Setup::install()'s fallback logic at lines 321-323.

Co-authored-by: printminion-co <145785698+printminion-co@users.noreply.github.com>
Copilot AI changed the title [WIP] Update postinstall event feature implementation test: improve InstallationCompletedEvent testing to verify parameter extraction from install options Jan 13, 2026
Copilot AI requested a review from printminion-co January 13, 2026 12:33
@printminion-co printminion-co marked this pull request as ready for review January 13, 2026 12:58
@printminion-co printminion-co merged commit bcdf047 into feature/add_postinstall_event Jan 13, 2026
4 of 12 checks passed
@printminion-co printminion-co deleted the copilot/sub-pr-179 branch January 13, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants